home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / taropyon / guilib3 / inc / fdl.h < prev    next >
C/C++ Source or Header  |  1993-11-30  |  9KB  |  279 lines

  1. /*    :*****************************************************************
  2.     :    "fdl.h"    :    ファイルダイアログ・ライブラリ
  3.     :*****************************************************************
  4. */
  5. #ifndef    _FDL_H
  6. #define    _FDL_H
  7.  
  8. #ifndef    _SPDEFS_H
  9. #    include    <spdefs.h>
  10. #endif
  11. #ifndef    _MOUSE_H
  12. #    include    <mouse.h>
  13. #endif
  14. #ifndef    _EVENT_H
  15. #    include    <event.h>
  16. #endif
  17. #ifndef    _DIALOG_H
  18. #    include    <dialog.h>
  19. #endif
  20. #ifndef    _SBAR_H
  21. #    include    <sbar.h>
  22. #endif
  23. #ifndef    _GST_H
  24. #    include    <gst.h>
  25. #endif
  26.  
  27. /*--------------------------------------------------------------------
  28.     ドライブアイコン構造体
  29. --------------------------------------------------------------------*/
  30. typedef    struct    _fdlDrvIcn_t            /* ドライブ情報保存用    */
  31. {
  32.     struct _fdlDrvIcn_t    *next;
  33.     SHORT                drv;        /* ドライブ番号                    */
  34.     SHORT                typ;        /* 種別                            */
  35.     SHORT                iconNo;        /* アイコン番号(24×24アイコン)    */
  36.     SHORT                x0, y0;        /* 表示位置                        */
  37.     SHORT                xs, ys;        /* アイコンの大きさ                */
  38.     SHORT                pixel;        /* ピクセル数                    */
  39.     char                *dat;        /* データ                        */
  40. } FDLDRVICN_T;
  41.  
  42. extern    FDLDRVICN_T    *FdlDrvIcnTop;
  43.  
  44. /*--------------------------------------------------------------------
  45.     ファイル名バッファ
  46. --------------------------------------------------------------------*/
  47. typedef    struct    _flbuf_t
  48. {
  49.     struct    _flbuf_t    *next;
  50.     int                    no;            /* ソートなし用の番号            */
  51.     int                    flag;        /* ワイルドカード選択用                */
  52.     int                    mark;        /* ユーザー選択用                */
  53.     unsigned int        att;        /* ファイル属性                    */
  54.     USHORT                time,date;    /* タイムスタンプ                */
  55.     size_t                size;        /* ファイルサイズ                */
  56.     char                name[16];    /* ファイル名                    */
  57.     SHORT                type;        /* ファイルタイプ(テキスト,EUP,TIF)    */
  58.     SHORT                icon;        /* アイコン番号                    */
  59. } _FLBUF_T;
  60.  
  61. /*--------------------------------------------------------------------
  62.     拡張子ごとのファイルのタイプ定義する構造体
  63. --------------------------------------------------------------------*/
  64. typedef    struct    _flobj_t
  65. {
  66.     struct    _flobj_t    *next;
  67.     int                    type;        /* タイプ番号            */
  68.     char                name[16];    /* ファイル名(拡張子)    */
  69. } _FLOBJ_T;
  70.  
  71.  
  72. /*--------------------------------------------------------------------
  73.     階層ファイルリスタ構造体
  74. --------------------------------------------------------------------*/
  75. typedef    struct    _flst_t
  76. {
  77.     struct _flst_t    *next, *prev;
  78. /*    struct _flst_t    *child, *parent;    */
  79.  
  80.     FRAME            fr;                    /* 表示枠                    */
  81.     EVT_T            *evt;                /* イベント                    */
  82.     EVT_T            *selEvt;            /* ファイル選択用イベント    */
  83.     SBAR_T            *sb;                /* スクロールバー            */
  84.     char            name[16];            /* 現ディレクトリ名            */
  85.     int                drv;
  86.     char            whare[128];            /* ディレクトリ                */
  87.     char            path[128];            /* パス名                    */
  88.  
  89.     char            dspFlag;            /* 表示されているか?        */
  90.     char            redspIgn;            /* 再表示の必要なし            */
  91.     char            _dmy_2;
  92.     char            _dmy_3;
  93.  
  94.     int                dspTop;
  95.     int                dspYm;
  96.  
  97.     _FLBUF_T        *flTop;
  98.     _FLBUF_T        **flBuf;
  99.  
  100.     int                allNum;
  101.     int                fileNum;
  102.     int                dirNum;
  103.     int                pickNum;
  104.  
  105.     void            *fdl;
  106.  
  107.     int                error;
  108.     CONST char        *errMsg;
  109. } _FLST_T;
  110.  
  111.  
  112. /*--------------------------------------------------------------------
  113.     マークファイル
  114. --------------------------------------------------------------------*/
  115. typedef struct _fdlmak_t
  116. {
  117.     struct _fdlmak_t    *next;
  118.     int                    no;            /* マークされた順番                */
  119.     unsigned int        att;        /* ファイル属性                    */
  120.     USHORT                time,date;    /* タイムスタンプ                */
  121.     size_t                size;        /* ファイルサイズ                */
  122.     char                fn[128];
  123. } FDLMAK_T;
  124. #define    FDLMAK_HASH_MAX    (64)
  125.  
  126. /*--------------------------------------------------------------------
  127.     ファイルスタック
  128. --------------------------------------------------------------------*/
  129. typedef struct _fdlstk_t
  130. {
  131.     struct _fdlstk_t    *next;
  132.     char                fn[1];
  133. } FDLSTK_T;
  134.  
  135.  
  136. /*--------------------------------------------------------------------
  137.     ファイルダイアログ構造体
  138. --------------------------------------------------------------------*/
  139. #define    FDL_GSTBUF_LEN    (128)
  140.  
  141. typedef    struct _fdl_t
  142. {
  143.     unsigned    cd;                        /* 状態フラグ        */
  144.     int            drv;                    /* ドライブ            */
  145.     char        whare[128];                /* ディレクトリ        */
  146.     char        wild[128];                /* ワイルドカード    */
  147.     int            sort;                    /* ソート種別        */
  148.  
  149.     int            dspTyp;                    /* 表示タイプ        */
  150.  
  151.     char        fvwDspFlag;                /* ファイルビュワー表示フラグ    */
  152.     char        fvwClsFlag;
  153.     SHORT        fvwYs;                    /* ファイルビュワの縦サイズ        */
  154.     FRAME        fvwFr;                    /* ファイルビュワー表示枠        */
  155.     SHORT        fvwDmy1, fvwDmy2;
  156.     size_t        fvwBufSiz;
  157.     char        *fvwBuf;
  158.     _FLST_T        *fvwFlst;
  159.  
  160.     char        multiSelFlag;            /* 複数選択フラグ                */
  161.     char        _dmy_flag_1;
  162.     char        _dmy_flag_2;
  163.     char        _dmy_flag_3;
  164.  
  165.     int            page;                    /* 表示ページ                */
  166.     DLG_T        *dlg;                    /* ダイアログ構造体            */
  167.     FRAME        fr;
  168.     MOSTKP_T    *mosTk;
  169.     char        *title;                    /* タイトル    */
  170.     COLOR        *colTbl;
  171.  
  172.     EVT_T        *evt;                    /* ベースイベント            */
  173.     EVT_T        *evtDrv;                /* ドライブイベント            */
  174.     GST_T        *gst;                    /* 文字列入力用                */
  175.     char        gstBuf[FDL_GSTBUF_LEN+4];
  176.  
  177.     FRAME        msFr;                    /* メインスクリーンフレーム    */
  178.  
  179.     SBAR_T        *flstSb;                /* スクロールバー用            */
  180.     _FLST_T        *flstTop;                /* ファイルリスター            */
  181.     _FLST_T        *flstCrt;                /* 現在ファイルリスタ        */
  182.     int            flstNum;                /* ファイルリスタの数        */
  183.     int            flstDspNo;                /* 表示先頭番号                */
  184.     int            flstDspNum;                /* 画面内に表示できる数        */
  185.  
  186.     int            makNum;                    /* マークされているファイル数    */
  187.     FDLMAK_T    *makHashBuf[FDLMAK_HASH_MAX];
  188.                                         /* ハッシュバッファ            */
  189.  
  190.     int            stkMax;                    /* スタック保持最大数        */
  191.     int            stkNum;                    /* 現在のスタック保持数        */
  192.     FDLSTK_T    *stkTop;                /* ファイル名スタック        */
  193.  
  194.     int            error;
  195.     CONST char    *errMsg;
  196.  
  197.     int            cx, cy;                    /* カーソル位置                */
  198. } FDL_T;
  199.  
  200. /*--------------------------------------------------------------------
  201.     ファイルダイアログの動作モードを指定するマクロ
  202. --------------------------------------------------------------------*/
  203. #define    FDL_MODE_SINGLE            (0x0000_0001)    /* ファイルをひとつだけ選択/指定        */
  204. #define    FDL_MODE_MULTI            (0x0000_0002)    /* 複数選択/指定                        */
  205. #define    FDL_MODE_PATH            (0x0000_0003)    /* ディレクトリ選択/指定                */
  206. #define    FDL_MODE_BIT_DIRIGN        (0x0000_0080)    /* サブディレクトリの選択/指定を禁止    */
  207. #define    FDL_MODE_BIT_DUPIGN        (0x0000_0800)    /* 同一ファイル1の選択を禁止する        */
  208. #define    FDL_MODE_BIT_EXIST        (0x0000_8000)    /* 存在するファイルのみ選択可能            */
  209. #define    FDL_MODE_BIT_SIDEWORK    (0x0001_0000)    /* サイドーク                            */
  210. #define    FDL_MODE_BIT_DOSCALL    (0x0002_0000)    /* DOS コマンド                            */
  211. #define    FDL_MODE_DEFAULT    (FDL_MODE_SINGLE|FDL_MODE_BIT_DIRIGN|FDL_MODE_BIT_SIDEWORK)
  212.  
  213. #define    FDL_SORT_OFF        (0)            /* ソートなし        */
  214. #define    FDL_SORT_FILE        (1)            /* ファイル名        */
  215. #define    FDL_SORT_SUB        (2)            /* 拡張子            */
  216. #define    FDL_SORT_DATE        (3)            /* 日付                */
  217. #define    FDL_SORT_SIZE        (4)            /* サイズ            */
  218. #define    FDL_SORT_RVS        (0x80)        /* 昇順/降順        */
  219. #define    FDL_SORT_DIRBIT        (0x60)
  220. #define    FDL_SORT_DIRTOP        (0x00)        /* ディレクトリ先頭    */
  221. #define    FDL_SORT_DIRLAST    (0x20)        /* ディレクトリ最後    */
  222. #define    FDL_SORT_DIROFF        (0x40)        /* ディレクトリ        */
  223.  
  224. #define    FDL_ISSORT_DIRTOP(_sort)    (((_sort)&FDL_SORT_DIRBIT) == FDL_SORT_DIRTOP)
  225. #define    FDL_ISSORT_DIRLAST(_sort)    (((_sort)&FDL_SORT_DIRBIT) == FDL_SORT_DIRLAST)
  226. #define    FDL_ISSORT_DIROFF(_sort)    (((_sort)&FDL_SORT_DIRBIT) == FDL_SORT_DIROFF)
  227.  
  228. /*    "fdl.h"        ----------------------------------------------------*/
  229. extern    int            FdlDefaultSort;
  230. extern    FDLDRVICN_T    *FdlDrvIcnTop;
  231.  
  232. extern    int        FDL_sysInit(void);
  233. extern    void    FDL_sysEnd(void);
  234.  
  235. /*    "fdl010.c"        ------------------------------------------------*/
  236. extern    int        FDL_set_gstWork( FDL_T *fdl, HIST_T *histSys );
  237. extern    FDL_T    *FDL_open( unsigned int cd );
  238. extern    int        FDL_set_title( FDL_T *fdl, CONST char *form, ... );
  239. extern    char    *FDL_get_filename( FDL_T *fdl );
  240. extern    int        FDL_close(FDL_T *fdl);
  241.  
  242. /*    "fdl011.c"        ------------------------------------------------*/
  243. extern    int        FDL_set_defaultFilename( FDL_T *fdl, CONST char *fn );
  244.  
  245. /*    "fdl012.c"        ------------------------------------------------*/
  246. extern    int        FDL_set_wildcard( FDL_T *fdl, CONST char *wild );
  247.  
  248. /*    "fdl013.c"        ------------------------------------------------*/
  249. extern    int        FDL_set_defaultMarkFile( FDL_T *fdl, CONST char *fn );
  250.  
  251. /*    "fdl014.c"        ------------------------------------------------*/
  252. extern    int        Fdl_set_sidework( int (*func)() );
  253.  
  254. /*    "fdl015.c"        ------------------------------------------------*/
  255. extern    int        Fdl_set_doscall( int (*openFunc)(void (*)()), void (*closeFunc)(), int (*systemFunc)(CONST char *));
  256.  
  257. /*    "fdl016.c"        ------------------------------------------------*/
  258. extern    int        FDL_set_startPath( FDL_T *fdl, int drv, CONST char *whare );
  259.  
  260. /*    "fdl017.c"        ------------------------------------------------*/
  261. extern    int        Fdl_set_helpFunc( int (*func)(int,EVTSBJ_T *) );
  262.  
  263. /*    "fdl018.c"        ------------------------------------------------*/
  264. extern    int        FDL_resetDrvSetup(void);
  265.  
  266. /*    "fdldicnc"        ------------------------------------------------*/
  267. extern    FDLDRVICN_T        *FDL_getDrvSetup(void);
  268. extern    void            FDL_drvMosCurType( FDLDRVICN_T *drvIcn, int drv );
  269.  
  270. /*    "fdlstart.c"    ------------------------------------------------*/
  271. extern    int        FDL_start( FDL_T *fdl );
  272.  
  273. /*    "fdlwild.c"    ------------------------------------------------*/
  274. extern    int        FdlSetWildCardList( CONST char *wild );
  275. extern    int        FdlSetWildCardHis( CONST char *wild );
  276. extern    char    *FdlWildCardMenu( int x0, int y0, char *wild );
  277.  
  278. #endif
  279.